<?php

require_once("conn.php");
$db = new DBC();

$sql = "DELETE FROM t_game_answer";
$db->execute($sql);
                
$dir = "../game/answer";
if (is_dir($dir)) {
    if (($dir_handle = opendir($dir)) != false) {
        while (($file = readdir($dir_handle)) !== false) {
            if ($file != "." && $file != "..") {
                $code = explode(".", $file);
                $url = getDomain()."game/answer/" . $file;
                $sql = "INSERT INTO t_game_answer(code,url,type,version,createTime) VALUES('" . $code[0] . "','" . $url . "','',1,now())";
                $db->execute($sql);
            }
        }
        closedir($dir_handle);
    }
}

echo "<script language='javascript'>location='questionAnswerList.php?menu=question';</script>";
?>
